<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AIfES 2: aimath_q31_default.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="AIfES_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AIfES 2
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('aimath__q31__default_8h.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">aimath_q31_default.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Math functions for <a class="el" href="aimath__q31_8h.html">Q31 </a> data type, default implementation.  
<a href="#details">More...</a></p>

<p><a href="aimath__q31__default_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a0b8e69c6c1bba4b937f95f211d035e11"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a0b8e69c6c1bba4b937f95f211d035e11">aimath_q31_default_linear32</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, const <a class="el" href="structaitensor.html">aitensor_t</a> *c, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a0b8e69c6c1bba4b937f95f211d035e11"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a matrix multiplication of <a class="el" href="aimath__q31_8h.html">Q31 </a> matrices a and b and adds a vector c to each row.  <a href="aimath__q31__default_8h.html#a0b8e69c6c1bba4b937f95f211d035e11">More...</a><br /></td></tr>
<tr class="separator:a0b8e69c6c1bba4b937f95f211d035e11"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a210ed501ad2308761defaf4c721d60a1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a210ed501ad2308761defaf4c721d60a1">aimath_q31_default_mat_mul</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a210ed501ad2308761defaf4c721d60a1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a matrix multiplication of <a class="el" href="aimath__q31_8h.html">Q31 </a> matrices a and b.  <a href="aimath__q31__default_8h.html#a210ed501ad2308761defaf4c721d60a1">More...</a><br /></td></tr>
<tr class="separator:a210ed501ad2308761defaf4c721d60a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4a59d9f24166fe63acb51a959bfff102"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a4a59d9f24166fe63acb51a959bfff102">aimath_q31_default_multiply</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a4a59d9f24166fe63acb51a959bfff102"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise multiplication of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors a and b (Hadamard product)  <a href="aimath__q31__default_8h.html#a4a59d9f24166fe63acb51a959bfff102">More...</a><br /></td></tr>
<tr class="separator:a4a59d9f24166fe63acb51a959bfff102"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07b0b5fde17397ed90e43c27673c83aa"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a07b0b5fde17397ed90e43c27673c83aa">aimath_q31_default_scalar_mul</a> (const void *scalar, const <a class="el" href="structaitensor.html">aitensor_t</a> *a, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a07b0b5fde17397ed90e43c27673c83aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs a scalar multiplication (scaling) of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor a and a scalar.  <a href="aimath__q31__default_8h.html#a07b0b5fde17397ed90e43c27673c83aa">More...</a><br /></td></tr>
<tr class="separator:a07b0b5fde17397ed90e43c27673c83aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaf4080020d251d878859d9a2ae27c53f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#aaf4080020d251d878859d9a2ae27c53f">aimath_q31_default_tensor_add_different_shift</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:aaf4080020d251d878859d9a2ae27c53f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise addition of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors a and b with different shifts.  <a href="aimath__q31__default_8h.html#aaf4080020d251d878859d9a2ae27c53f">More...</a><br /></td></tr>
<tr class="separator:aaf4080020d251d878859d9a2ae27c53f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7f943a7bdaed4630bb1e2a8418898dc1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a7f943a7bdaed4630bb1e2a8418898dc1">aimath_q31_default_tensor_add_same_shift</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a7f943a7bdaed4630bb1e2a8418898dc1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise addition of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors a and b with same shifts.  <a href="aimath__q31__default_8h.html#a7f943a7bdaed4630bb1e2a8418898dc1">More...</a><br /></td></tr>
<tr class="separator:a7f943a7bdaed4630bb1e2a8418898dc1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0519d352e63c9eee09450bb434bf76cf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a0519d352e63c9eee09450bb434bf76cf">aimath_q31_default_tensor_sub_different_shift</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a0519d352e63c9eee09450bb434bf76cf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise subtraction of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors a and b with different shifts.  <a href="aimath__q31__default_8h.html#a0519d352e63c9eee09450bb434bf76cf">More...</a><br /></td></tr>
<tr class="separator:a0519d352e63c9eee09450bb434bf76cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa21f4253c5887e2c14138fe8ccd269a5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#aa21f4253c5887e2c14138fe8ccd269a5">aimath_q31_default_tensor_sub_same_shift</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *a, const <a class="el" href="structaitensor.html">aitensor_t</a> *b, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:aa21f4253c5887e2c14138fe8ccd269a5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise subtraction of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors a and b with same shifts.  <a href="aimath__q31__default_8h.html#aa21f4253c5887e2c14138fe8ccd269a5">More...</a><br /></td></tr>
<tr class="separator:aa21f4253c5887e2c14138fe8ccd269a5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ace86d3315e02380430b5ccb30c1654cd"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#ace86d3315e02380430b5ccb30c1654cd">aimath_q31_default_copy_tensor</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *from, <a class="el" href="structaitensor.html">aitensor_t</a> *to)</td></tr>
<tr class="memdesc:ace86d3315e02380430b5ccb30c1654cd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Performs an element wise copy of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors.  <a href="aimath__q31__default_8h.html#ace86d3315e02380430b5ccb30c1654cd">More...</a><br /></td></tr>
<tr class="separator:ace86d3315e02380430b5ccb30c1654cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aabfe1ffbe35e165f62f11a6b25096415"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#aabfe1ffbe35e165f62f11a6b25096415">aimath_q31_default_transpose_vector</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *vector)</td></tr>
<tr class="memdesc:aabfe1ffbe35e165f62f11a6b25096415"><td class="mdescLeft">&#160;</td><td class="mdescRight">Transposes a <a class="el" href="aimath__q31_8h.html">Q31 </a> vector.  <a href="aimath__q31__default_8h.html#aabfe1ffbe35e165f62f11a6b25096415">More...</a><br /></td></tr>
<tr class="separator:aabfe1ffbe35e165f62f11a6b25096415"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1eee53561fd10925686daef72b5f5680"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a1eee53561fd10925686daef72b5f5680">aimath_q31_default_norm_squared</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, void *result)</td></tr>
<tr class="memdesc:a1eee53561fd10925686daef72b5f5680"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the squared sum of all elements in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#a1eee53561fd10925686daef72b5f5680">More...</a><br /></td></tr>
<tr class="separator:a1eee53561fd10925686daef72b5f5680"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afbbdfc6c4787782533e79df8aab5c3ba"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#afbbdfc6c4787782533e79df8aab5c3ba">aimath_q31_default_tensor_sqrt</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:afbbdfc6c4787782533e79df8aab5c3ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the element wise square root of a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#afbbdfc6c4787782533e79df8aab5c3ba">More...</a><br /></td></tr>
<tr class="separator:afbbdfc6c4787782533e79df8aab5c3ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a173b48fe6e4d1fb5dcb441954a05afe7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a173b48fe6e4d1fb5dcb441954a05afe7">aimath_q31_default_sigmoid</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a173b48fe6e4d1fb5dcb441954a05afe7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the sigmoid of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#a173b48fe6e4d1fb5dcb441954a05afe7">More...</a><br /></td></tr>
<tr class="separator:a173b48fe6e4d1fb5dcb441954a05afe7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a23148227bece10be2f8b16b07df1c6cb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a23148227bece10be2f8b16b07df1c6cb">aimath_q31_default_d_sigmoid</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *sigmoid_x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a23148227bece10be2f8b16b07df1c6cb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the derivative sigmoid of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#a23148227bece10be2f8b16b07df1c6cb">More...</a><br /></td></tr>
<tr class="separator:a23148227bece10be2f8b16b07df1c6cb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae308be51fead200a1bd035e22dc2b9ba"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#ae308be51fead200a1bd035e22dc2b9ba">aimath_q31_default_relu</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:ae308be51fead200a1bd035e22dc2b9ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the rectifier (ReLU) value of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#ae308be51fead200a1bd035e22dc2b9ba">More...</a><br /></td></tr>
<tr class="separator:ae308be51fead200a1bd035e22dc2b9ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeca69423ea281e6b616d1ef4784a21cf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#aeca69423ea281e6b616d1ef4784a21cf">aimath_q31_default_d_relu</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:aeca69423ea281e6b616d1ef4784a21cf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the rectifier (ReLU) derivative of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#aeca69423ea281e6b616d1ef4784a21cf">More...</a><br /></td></tr>
<tr class="separator:aeca69423ea281e6b616d1ef4784a21cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8639f9d5f5da2d7255e157902d07777b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a8639f9d5f5da2d7255e157902d07777b">aimath_q31_default_leaky_relu</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, const void *alpha, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a8639f9d5f5da2d7255e157902d07777b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the leaky rectifier (leaky ReLU) value of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#a8639f9d5f5da2d7255e157902d07777b">More...</a><br /></td></tr>
<tr class="separator:a8639f9d5f5da2d7255e157902d07777b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a20f3c6582f1a05da2ca8821d6804d6d0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a20f3c6582f1a05da2ca8821d6804d6d0">aimath_q31_default_d_leaky_relu</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, const void *alpha, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a20f3c6582f1a05da2ca8821d6804d6d0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the leaky rectifier (leaky-ReLU) derivative of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#a20f3c6582f1a05da2ca8821d6804d6d0">More...</a><br /></td></tr>
<tr class="separator:a20f3c6582f1a05da2ca8821d6804d6d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aeceeacc1c2046dfa41991a39712ab030"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#aeceeacc1c2046dfa41991a39712ab030">aimath_q31_default_tanh</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:aeceeacc1c2046dfa41991a39712ab030"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the tanh of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#aeceeacc1c2046dfa41991a39712ab030">More...</a><br /></td></tr>
<tr class="separator:aeceeacc1c2046dfa41991a39712ab030"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad2f48e32e7e525050c4df4602a5d5ba4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#ad2f48e32e7e525050c4df4602a5d5ba4">aimath_q31_default_d_tanh</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *tanh_x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:ad2f48e32e7e525050c4df4602a5d5ba4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the tanh derivative of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#ad2f48e32e7e525050c4df4602a5d5ba4">More...</a><br /></td></tr>
<tr class="separator:ad2f48e32e7e525050c4df4602a5d5ba4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acc0a1bce305f17cc13ed7ae96e17288f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#acc0a1bce305f17cc13ed7ae96e17288f">aimath_q31_default_softsign</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:acc0a1bce305f17cc13ed7ae96e17288f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the softsign value of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#acc0a1bce305f17cc13ed7ae96e17288f">More...</a><br /></td></tr>
<tr class="separator:acc0a1bce305f17cc13ed7ae96e17288f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ade419ce3010e7eb1309e01a2d9f6d53c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#ade419ce3010e7eb1309e01a2d9f6d53c">aimath_q31_default_d_softsign</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:ade419ce3010e7eb1309e01a2d9f6d53c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the softsign activation derivative of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#ade419ce3010e7eb1309e01a2d9f6d53c">More...</a><br /></td></tr>
<tr class="separator:ade419ce3010e7eb1309e01a2d9f6d53c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa79d9561f6461efaf6bd01590d38ae98"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#aa79d9561f6461efaf6bd01590d38ae98">aimath_q31_default_softmax</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:aa79d9561f6461efaf6bd01590d38ae98"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the softmax value of each batch element (row) of a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#aa79d9561f6461efaf6bd01590d38ae98">More...</a><br /></td></tr>
<tr class="separator:aa79d9561f6461efaf6bd01590d38ae98"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae56af0b1607688bbec4d1a0954e33ece"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#ae56af0b1607688bbec4d1a0954e33ece">aimath_q31_default_elu</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, const void *alpha, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:ae56af0b1607688bbec4d1a0954e33ece"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the exponential rectifier (ELU) value of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#ae56af0b1607688bbec4d1a0954e33ece">More...</a><br /></td></tr>
<tr class="separator:ae56af0b1607688bbec4d1a0954e33ece"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a0176a54b8885e46e3749d4a85e6e22"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a9a0176a54b8885e46e3749d4a85e6e22">aimath_q31_default_d_elu</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, const void *alpha, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a9a0176a54b8885e46e3749d4a85e6e22"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the exponential rectifier (ELU) derivative of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor.  <a href="aimath__q31__default_8h.html#a9a0176a54b8885e46e3749d4a85e6e22">More...</a><br /></td></tr>
<tr class="separator:a9a0176a54b8885e46e3749d4a85e6e22"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a363b2bdd94a1057adc55433ab68580a1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a363b2bdd94a1057adc55433ab68580a1">aimath_q31_default_zero_tensor</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *tensor)</td></tr>
<tr class="memdesc:a363b2bdd94a1057adc55433ab68580a1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with zeros.  <a href="aimath__q31__default_8h.html#a363b2bdd94a1057adc55433ab68580a1">More...</a><br /></td></tr>
<tr class="separator:a363b2bdd94a1057adc55433ab68580a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a68d535888ca0bc7155a80e53e3a56725"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a68d535888ca0bc7155a80e53e3a56725">aimath_q31_default_init_zeros</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *tensor)</td></tr>
<tr class="memdesc:a68d535888ca0bc7155a80e53e3a56725"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with zeros.  <a href="aimath__q31__default_8h.html#a68d535888ca0bc7155a80e53e3a56725">More...</a><br /></td></tr>
<tr class="separator:a68d535888ca0bc7155a80e53e3a56725"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aefab1f6288cfad6d4d65b095d6c2283d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#aefab1f6288cfad6d4d65b095d6c2283d">aimath_q31_default_tensor_init_uniform</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *tensor, float from, float to)</td></tr>
<tr class="memdesc:aefab1f6288cfad6d4d65b095d6c2283d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with random numbers created from a uniform distribution within given range.  <a href="aimath__q31__default_8h.html#aefab1f6288cfad6d4d65b095d6c2283d">More...</a><br /></td></tr>
<tr class="separator:aefab1f6288cfad6d4d65b095d6c2283d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acfffcef30d301ff065e45649e49f01f9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#acfffcef30d301ff065e45649e49f01f9">aimath_q31_default_init_glorot_uniform</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *tensor)</td></tr>
<tr class="memdesc:acfffcef30d301ff065e45649e49f01f9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with random numbers uniformly within given range, according to Glorot et al.  <a href="aimath__q31__default_8h.html#acfffcef30d301ff065e45649e49f01f9">More...</a><br /></td></tr>
<tr class="separator:acfffcef30d301ff065e45649e49f01f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2136e9dca291d32750d09ada2e011b06"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a2136e9dca291d32750d09ada2e011b06">aimath_q31_default_init_glorot_uniform_cdim</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *tensor, int8_t cin_axis, int8_t cout_axis)</td></tr>
<tr class="memdesc:a2136e9dca291d32750d09ada2e011b06"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with random numbers uniformly within given range, according to Glorot et al.  <a href="aimath__q31__default_8h.html#a2136e9dca291d32750d09ada2e011b06">More...</a><br /></td></tr>
<tr class="separator:a2136e9dca291d32750d09ada2e011b06"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9db8333bc23a9bb803958a76e0a759c3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a9db8333bc23a9bb803958a76e0a759c3">aimath_q31_default_init_he_uniform</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *tensor)</td></tr>
<tr class="memdesc:a9db8333bc23a9bb803958a76e0a759c3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with random numbers uniformly within given range, according to He et al.  <a href="aimath__q31__default_8h.html#a9db8333bc23a9bb803958a76e0a759c3">More...</a><br /></td></tr>
<tr class="separator:a9db8333bc23a9bb803958a76e0a759c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abfef1cdcd2d1c8824ec69a565375ee44"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#abfef1cdcd2d1c8824ec69a565375ee44">aimath_q31_default_init_he_uniform_cdim</a> (<a class="el" href="structaitensor.html">aitensor_t</a> *tensor, int8_t cout_axis)</td></tr>
<tr class="memdesc:abfef1cdcd2d1c8824ec69a565375ee44"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with random numbers uniformly within given range, according to He et al.  <a href="aimath__q31__default_8h.html#abfef1cdcd2d1c8824ec69a565375ee44">More...</a><br /></td></tr>
<tr class="separator:abfef1cdcd2d1c8824ec69a565375ee44"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad24f7f3d3b8085e7b306dcfd25eedee5"><td class="memItemLeft" align="right" valign="top">int64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#ad24f7f3d3b8085e7b306dcfd25eedee5">aimath_q31_default_sqrt</a> (int64_t x)</td></tr>
<tr class="memdesc:ad24f7f3d3b8085e7b306dcfd25eedee5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates square root of an int64 value.  <a href="aimath__q31__default_8h.html#ad24f7f3d3b8085e7b306dcfd25eedee5">More...</a><br /></td></tr>
<tr class="separator:ad24f7f3d3b8085e7b306dcfd25eedee5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8ab2008f6346986684d2b5b7a95fc5e0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="aimath__q31__default_8h.html#a8ab2008f6346986684d2b5b7a95fc5e0">aimath_q31_default_sum_channelwise</a> (const <a class="el" href="structaitensor.html">aitensor_t</a> *x, int8_t channel_axis, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="memdesc:a8ab2008f6346986684d2b5b7a95fc5e0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sums up all values of a channel of the <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor x.  <a href="aimath__q31__default_8h.html#a8ab2008f6346986684d2b5b7a95fc5e0">More...</a><br /></td></tr>
<tr class="separator:a8ab2008f6346986684d2b5b7a95fc5e0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9859dcd2d3f04166282ef2a6ff26efc2"><td class="memItemLeft" align="right" valign="top"><a id="a9859dcd2d3f04166282ef2a6ff26efc2"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>aimath_q31_default_mse_gradients_sum</b> (const <a class="el" href="structaitensor.html">aitensor_t</a> *predicted, const <a class="el" href="structaitensor.html">aitensor_t</a> *target, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="separator:a9859dcd2d3f04166282ef2a6ff26efc2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a62b5ff5b169a38755c5c5e680014747b"><td class="memItemLeft" align="right" valign="top"><a id="a62b5ff5b169a38755c5c5e680014747b"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>aimath_q31_default_mse_gradients_mean</b> (const <a class="el" href="structaitensor.html">aitensor_t</a> *predicted, const <a class="el" href="structaitensor.html">aitensor_t</a> *target, <a class="el" href="structaitensor.html">aitensor_t</a> *result)</td></tr>
<tr class="separator:a62b5ff5b169a38755c5c5e680014747b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6768760725541c42f54caa694ab207db"><td class="memItemLeft" align="right" valign="top"><a id="a6768760725541c42f54caa694ab207db"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>aimath_q31_default_mse_loss_sum</b> (const <a class="el" href="structaitensor.html">aitensor_t</a> *predicted, const <a class="el" href="structaitensor.html">aitensor_t</a> *target, void *result)</td></tr>
<tr class="separator:a6768760725541c42f54caa694ab207db"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a80747c0bc6cf5a38d3c16d1c1da2d462"><td class="memItemLeft" align="right" valign="top"><a id="a80747c0bc6cf5a38d3c16d1c1da2d462"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>aimath_q31_default_mse_loss_mean</b> (const <a class="el" href="structaitensor.html">aitensor_t</a> *predicted, const <a class="el" href="structaitensor.html">aitensor_t</a> *target, void *result)</td></tr>
<tr class="separator:a80747c0bc6cf5a38d3c16d1c1da2d462"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Math functions for <a class="el" href="aimath__q31_8h.html">Q31 </a> data type, default implementation. </p>
<dl class="section version"><dt>Version</dt><dd>2.2.0 </dd></dl>
<dl class="section copyright"><dt>Copyright</dt><dd>Copyright (C) 2020-2023 Fraunhofer Institute for Microelectronic Circuits and Systems. All rights reserved.<br  />
<br  />
 AIfES is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.<br  />
<br  />
 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.<br  />
<br  />
 You should have received a copy of the GNU Affero General Public License along with this program. If not, see <a href="https://www.gnu.org/licenses/">https://www.gnu.org/licenses/</a>.</dd></dl>
<p>These functions can be used when no hardware specific implementation is available. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ace86d3315e02380430b5ccb30c1654cd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ace86d3315e02380430b5ccb30c1654cd">&#9670;&nbsp;</a></span>aimath_q31_default_copy_tensor()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_copy_tensor </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>from</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>to</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise copy of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors. </p>
<p class="formulaDsp">
\[ to \leftarrow from \]
</p>
<p>Dimension, shape and quantization parameters of from and to tensors have to be the same.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t from_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> from_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t from_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                           -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> from = AITENSOR_2D_Q31(from_shape, &amp;from_params, from_data);</div>
<div class="line"> </div>
<div class="line">uint16_t to_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> to_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t to_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> to = AITENSOR_2D_Q31(to_shape, &amp;to_params, to_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#ace86d3315e02380430b5ccb30c1654cd">aimath_q31_default_copy_tensor</a>(&amp;from, &amp;to);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;to);</div>
<div class="ttc" id="aaimath__basic_8h_html_ab10c8d06990943806f0be8fcc6af03fc"><div class="ttname"><a href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a></div><div class="ttdeci">void print_aitensor(const aitensor_t *tensor)</div><div class="ttdoc">Printing a tensor to console.</div></div>
<div class="ttc" id="aaimath__q31__default_8h_html_ace86d3315e02380430b5ccb30c1654cd"><div class="ttname"><a href="aimath__q31__default_8h.html#ace86d3315e02380430b5ccb30c1654cd">aimath_q31_default_copy_tensor</a></div><div class="ttdeci">void aimath_q31_default_copy_tensor(const aitensor_t *from, aitensor_t *to)</div><div class="ttdoc">Performs an element wise copy of Q31  tensors.</div></div>
<div class="ttc" id="astructaimath__q31__params_html"><div class="ttname"><a href="structaimath__q31__params.html">aimath_q31_params</a></div><div class="ttdoc">Parameters used for the quantized Q31  values, used as property of a tensor.</div><div class="ttdef"><b>Definition:</b> aimath_q31.h:149</div></div>
<div class="ttc" id="astructaitensor_html"><div class="ttname"><a href="structaitensor.html">aitensor</a></div><div class="ttdoc">A tensor in AIfES.</div><div class="ttdef"><b>Definition:</b> aifes_math.h:89</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*from</td><td>Q31 tensor to copy from (N-D tensor) </td></tr>
    <tr><td class="paramname">*to</td><td>Q31 tensor to copy to (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a9a0176a54b8885e46e3749d4a85e6e22"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9a0176a54b8885e46e3749d4a85e6e22">&#9670;&nbsp;</a></span>aimath_q31_default_d_elu()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_d_elu </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>alpha</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the exponential rectifier (ELU) derivative of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \begin{cases} \alpha \cdot e^{x_i} &amp; \text{if } x_i &lt; 0\\ 1 &amp; \text{if } x_i \geq 0 \end{cases} \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="structaiscalar__q31.html">aiscalar_q31_t</a> alpha = AISCALAR_Q31(1.0f, 0, 0);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a9a0176a54b8885e46e3749d4a85e6e22">aimath_q31_default_d_elu</a>(&amp;x, &amp;alpha, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a9a0176a54b8885e46e3749d4a85e6e22"><div class="ttname"><a href="aimath__q31__default_8h.html#a9a0176a54b8885e46e3749d4a85e6e22">aimath_q31_default_d_elu</a></div><div class="ttdeci">void aimath_q31_default_d_elu(const aitensor_t *x, const void *alpha, aitensor_t *result)</div><div class="ttdoc">Calculates the exponential rectifier (ELU) derivative of each element in a Q31  tensor.</div></div>
<div class="ttc" id="astructaiscalar__q31_html"><div class="ttname"><a href="structaiscalar__q31.html">aiscalar_q31</a></div><div class="ttdoc">Single quantized Q31  value/scalar.</div><div class="ttdef"><b>Definition:</b> aimath_q31.h:156</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the ELU derivative from (N-D tensor) </td></tr>
    <tr><td class="paramname">*alpha</td><td>Scalar \( \alpha \) (type aiscalar_q31_t) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a20f3c6582f1a05da2ca8821d6804d6d0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a20f3c6582f1a05da2ca8821d6804d6d0">&#9670;&nbsp;</a></span>aimath_q31_default_d_leaky_relu()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_d_leaky_relu </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>alpha</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the leaky rectifier (leaky-ReLU) derivative of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{ij} = \begin{cases} alpha &amp; \text{if } x_i &lt; 0\\ 1 &amp; \text{if } x_i \geq 0 \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 0, zero_point = 0} by the function because the output values are either alpha or 1.</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a20f3c6582f1a05da2ca8821d6804d6d0">aimath_q31_default_d_leaky_relu</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a20f3c6582f1a05da2ca8821d6804d6d0"><div class="ttname"><a href="aimath__q31__default_8h.html#a20f3c6582f1a05da2ca8821d6804d6d0">aimath_q31_default_d_leaky_relu</a></div><div class="ttdeci">void aimath_q31_default_d_leaky_relu(const aitensor_t *x, const void *alpha, aitensor_t *result)</div><div class="ttdoc">Calculates the leaky rectifier (leaky-ReLU) derivative of each element in a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the leaky-ReLU derivative from (N-D tensor) </td></tr>
    <tr><td class="paramname">*alpha</td><td>Scalar \( \alpha \) (type aiscalar_q31_t) for the leakage </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aeca69423ea281e6b616d1ef4784a21cf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeca69423ea281e6b616d1ef4784a21cf">&#9670;&nbsp;</a></span>aimath_q31_default_d_relu()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_d_relu </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the rectifier (ReLU) derivative of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{ij} = \begin{cases} 0 &amp; \text{if } x_i &lt; 0\\ 1 &amp; \text{if } x_i \geq 0 \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 0, zero_point = 0} by the function because the output values are either 0 or 1.</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#aeca69423ea281e6b616d1ef4784a21cf">aimath_q31_default_d_relu</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_aeca69423ea281e6b616d1ef4784a21cf"><div class="ttname"><a href="aimath__q31__default_8h.html#aeca69423ea281e6b616d1ef4784a21cf">aimath_q31_default_d_relu</a></div><div class="ttdeci">void aimath_q31_default_d_relu(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the rectifier (ReLU) derivative of each element in a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the ReLU derivative from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a23148227bece10be2f8b16b07df1c6cb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a23148227bece10be2f8b16b07df1c6cb">&#9670;&nbsp;</a></span>aimath_q31_default_d_sigmoid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_d_sigmoid </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>sigmoid_x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the derivative sigmoid of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \sigma&#39;(x_{i}) = \sigma(x_{i}) \cdot (1 - \sigma(x_{i})) \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 34, zero_point = -2^31} by the function because the output values are in the interval (0, 0.25].</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params;</div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a173b48fe6e4d1fb5dcb441954a05afe7">aimath_q31_default_sigmoid</a>(&amp;x, &amp;result);</div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a23148227bece10be2f8b16b07df1c6cb">aimath_q31_default_d_sigmoid</a>(&amp;result, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a173b48fe6e4d1fb5dcb441954a05afe7"><div class="ttname"><a href="aimath__q31__default_8h.html#a173b48fe6e4d1fb5dcb441954a05afe7">aimath_q31_default_sigmoid</a></div><div class="ttdeci">void aimath_q31_default_sigmoid(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the sigmoid of each element in a Q31  tensor.</div></div>
<div class="ttc" id="aaimath__q31__default_8h_html_a23148227bece10be2f8b16b07df1c6cb"><div class="ttname"><a href="aimath__q31__default_8h.html#a23148227bece10be2f8b16b07df1c6cb">aimath_q31_default_d_sigmoid</a></div><div class="ttdeci">void aimath_q31_default_d_sigmoid(const aitensor_t *sigmoid_x, aitensor_t *result)</div><div class="ttdoc">Calculates the derivative sigmoid of each element in a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*sigmoid_x</td><td>Q31 tensor with the sigmoid values \( \sigma(x_{i}) \) (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ade419ce3010e7eb1309e01a2d9f6d53c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ade419ce3010e7eb1309e01a2d9f6d53c">&#9670;&nbsp;</a></span>aimath_q31_default_d_softsign()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_d_softsign </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the softsign activation derivative of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \frac {1} {(1 + |x_i|)^2} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 32, zero_point = -2^31} by the function because the output values are in the interval (0, 1).</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#ade419ce3010e7eb1309e01a2d9f6d53c">aimath_q31_default_d_softsign</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_ade419ce3010e7eb1309e01a2d9f6d53c"><div class="ttname"><a href="aimath__q31__default_8h.html#ade419ce3010e7eb1309e01a2d9f6d53c">aimath_q31_default_d_softsign</a></div><div class="ttdeci">void aimath_q31_default_d_softsign(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the softsign activation derivative of each element in a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the softsign derivative from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ad2f48e32e7e525050c4df4602a5d5ba4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad2f48e32e7e525050c4df4602a5d5ba4">&#9670;&nbsp;</a></span>aimath_q31_default_d_tanh()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_d_tanh </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>tanh_x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the tanh derivative of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \tanh&#39;(x_{i}) = 1 - \tanh(x_{i}) * \tanh(x_{i}) \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 32, zero_point = -2^31} by the function because the output values are in the interval (0, 1].</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params;</div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#aeceeacc1c2046dfa41991a39712ab030">aimath_q31_default_tanh</a>(&amp;x, &amp;result);</div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#ad2f48e32e7e525050c4df4602a5d5ba4">aimath_q31_default_d_tanh</a>(&amp;result, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_ad2f48e32e7e525050c4df4602a5d5ba4"><div class="ttname"><a href="aimath__q31__default_8h.html#ad2f48e32e7e525050c4df4602a5d5ba4">aimath_q31_default_d_tanh</a></div><div class="ttdeci">void aimath_q31_default_d_tanh(const aitensor_t *tanh_x, aitensor_t *result)</div><div class="ttdoc">Calculates the tanh derivative of each element in a Q31  tensor.</div></div>
<div class="ttc" id="aaimath__q31__default_8h_html_aeceeacc1c2046dfa41991a39712ab030"><div class="ttname"><a href="aimath__q31__default_8h.html#aeceeacc1c2046dfa41991a39712ab030">aimath_q31_default_tanh</a></div><div class="ttdeci">void aimath_q31_default_tanh(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the tanh of each element in a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*tanh_x</td><td>Q31 tensor with the tanh values \( \tanh(x_{i}) \) (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ae56af0b1607688bbec4d1a0954e33ece"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae56af0b1607688bbec4d1a0954e33ece">&#9670;&nbsp;</a></span>aimath_q31_default_elu()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_elu </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>alpha</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the exponential rectifier (ELU) value of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \begin{cases} \alpha \cdot (e^{x_i} - 1) &amp; \text{if } x_i &lt; 0 \\ x_i &amp; \text{if } x_i \geq 0 \end{cases} \]
</p>
<p>The ELU is calculated with a piecewise linear approximation to avoid using exponential functions.</p>
<p class="formulaDsp">
\[ result_{i} = \begin{cases} x_i &amp; \text{if } 0 \leq x_i\\ \alpha \cdot 0.625 \cdot x_i &amp; \text{if } -1 \leq x &lt; 0\\ \alpha \cdot (0.25 \cdot x_i - 0.375) &amp; \text{if } -2 \leq x &lt; -1\\ \alpha \cdot (0.09375 \cdot x_i - 0.6875) &amp; \text{if } -3 \leq x &lt; -2\\ \alpha \cdot (0.03125 \cdot x_i - 0.875) &amp; \text{if } -4 \leq x &lt; -3\\ - \alpha &amp; \text{if } x &lt; -4 \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = x.shift, zero_point = x.zero_point} by the function because the output values are in the interval (max(-alpha, min(x)), max(x)].</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="structaiscalar__q31.html">aiscalar_q31_t</a> alpha = AISCALAR_Q31(1.0f, 0, 0);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#ae56af0b1607688bbec4d1a0954e33ece">aimath_q31_default_elu</a>(&amp;x, &amp;alpha, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_ae56af0b1607688bbec4d1a0954e33ece"><div class="ttname"><a href="aimath__q31__default_8h.html#ae56af0b1607688bbec4d1a0954e33ece">aimath_q31_default_elu</a></div><div class="ttdeci">void aimath_q31_default_elu(const aitensor_t *x, const void *alpha, aitensor_t *result)</div><div class="ttdoc">Calculates the exponential rectifier (ELU) value of each element in a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the ELU from (N-D tensor) </td></tr>
    <tr><td class="paramname">*alpha</td><td>Scalar \( \alpha \) (type aiscalar_q31_t) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="acfffcef30d301ff065e45649e49f01f9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acfffcef30d301ff065e45649e49f01f9">&#9670;&nbsp;</a></span>aimath_q31_default_init_glorot_uniform()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_init_glorot_uniform </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>tensor</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with random numbers uniformly within given range, according to Glorot et al. </p>
<p>Same functionality as <a class="el" href="aimath__q31__default_8h.html#a2136e9dca291d32750d09ada2e011b06" title="Fills a Q31  tensor with random numbers uniformly within given range, according to Glorot et al.">aimath_q31_default_init_glorot_uniform_cdim()</a> with cin_axis = 0 and cout_axis = 1 (channels last dataformat).</p>
<p class="formulaDsp">
\[ fan_{avg} = \frac{fan_{in} + fan_{out}}{2} \]
</p>
 <p class="formulaDsp">
\[ r = \sqrt{\frac{3}{fan_{avg}}} \]
</p>
 <p class="formulaDsp">
\[ tensor_i \in \mathcal{U(-r, r)} \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t tensor_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> tensor_params = {20, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t tensor_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> tensor = AITENSOR_2D_Q31(tensor_shape, &amp;tensor_params, tensor_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#acfffcef30d301ff065e45649e49f01f9">aimath_q31_default_init_glorot_uniform</a>(&amp;tensor);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;tensor);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_acfffcef30d301ff065e45649e49f01f9"><div class="ttname"><a href="aimath__q31__default_8h.html#acfffcef30d301ff065e45649e49f01f9">aimath_q31_default_init_glorot_uniform</a></div><div class="ttdeci">void aimath_q31_default_init_glorot_uniform(aitensor_t *tensor)</div><div class="ttdoc">Fills a Q31  tensor with random numbers uniformly within given range, according to Glorot et al.</div></div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd>Glorot et al., 2010 ( <a href="http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf">http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf</a> )</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*tensor</td><td>Q31 tensor to initialize with random numbers (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a2136e9dca291d32750d09ada2e011b06"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2136e9dca291d32750d09ada2e011b06">&#9670;&nbsp;</a></span>aimath_q31_default_init_glorot_uniform_cdim()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_init_glorot_uniform_cdim </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>tensor</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int8_t&#160;</td>
          <td class="paramname"><em>cin_axis</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int8_t&#160;</td>
          <td class="paramname"><em>cout_axis</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with random numbers uniformly within given range, according to Glorot et al. </p>
<p class="formulaDsp">
\[ fan_{avg} = \frac{fan_{in} + fan_{out}}{2} \]
</p>
 <p class="formulaDsp">
\[ r = \sqrt{\frac{3}{fan_{avg}}} \]
</p>
 <p class="formulaDsp">
\[ tensor_i \in \mathcal{U(-r, r)} \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t tensor_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> tensor_params = {20, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t tensor_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> tensor = AITENSOR_2D_Q31(tensor_shape, &amp;tensor_params, tensor_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a2136e9dca291d32750d09ada2e011b06">aimath_q31_default_init_glorot_uniform_cdim</a>(&amp;tensor, 0, 1);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;tensor);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a2136e9dca291d32750d09ada2e011b06"><div class="ttname"><a href="aimath__q31__default_8h.html#a2136e9dca291d32750d09ada2e011b06">aimath_q31_default_init_glorot_uniform_cdim</a></div><div class="ttdeci">void aimath_q31_default_init_glorot_uniform_cdim(aitensor_t *tensor, int8_t cin_axis, int8_t cout_axis)</div><div class="ttdoc">Fills a Q31  tensor with random numbers uniformly within given range, according to Glorot et al.</div></div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd>Glorot et al., 2010 ( <a href="http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf">http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf</a> )</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*tensor</td><td>Q31 tensor to initialize with random numbers (N-D tensor) </td></tr>
    <tr><td class="paramname">cin_axis</td><td>Axis of the input channels (negative number means indexing from the end) </td></tr>
    <tr><td class="paramname">cout_axis</td><td>Axis of the output channels (negative number means indexing from the end) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a9db8333bc23a9bb803958a76e0a759c3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9db8333bc23a9bb803958a76e0a759c3">&#9670;&nbsp;</a></span>aimath_q31_default_init_he_uniform()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_init_he_uniform </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>tensor</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with random numbers uniformly within given range, according to He et al. </p>
<p>Same functionality as <a class="el" href="aimath__q31__default_8h.html#abfef1cdcd2d1c8824ec69a565375ee44" title="Fills a Q31  tensor with random numbers uniformly within given range, according to He et al.">aimath_q31_default_init_he_uniform_cdim()</a> with cout_axis = 1 (channels last dataformat).</p>
<p class="formulaDsp">
\[ fan_{avg} = \frac{fan_{in}}{2} \]
</p>
 <p class="formulaDsp">
\[ r = \sqrt{\frac{3}{fan_{avg}}} \]
</p>
 <p class="formulaDsp">
\[ tensor_i \in \mathcal{U(-r, r)} \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t tensor_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> tensor_params = {20, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t tensor_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> tensor = AITENSOR_2D_Q31(tensor_shape, &amp;tensor_params, tensor_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a9db8333bc23a9bb803958a76e0a759c3">aimath_q31_default_init_he_uniform</a>(&amp;tensor);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;tensor);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a9db8333bc23a9bb803958a76e0a759c3"><div class="ttname"><a href="aimath__q31__default_8h.html#a9db8333bc23a9bb803958a76e0a759c3">aimath_q31_default_init_he_uniform</a></div><div class="ttdeci">void aimath_q31_default_init_he_uniform(aitensor_t *tensor)</div><div class="ttdoc">Fills a Q31  tensor with random numbers uniformly within given range, according to He et al.</div></div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd>He et al., 2015 ( <a href="https://www.cv-foundation.org/openaccess/content_iccv_2015/html/He_Delving_Deep_into_ICCV_2015_paper.html">https://www.cv-foundation.org/openaccess/content_iccv_2015/html/He_Delving_Deep_into_ICCV_2015_paper.html</a> )</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*tensor</td><td>Q31 tensor to initialize with random numbers (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="abfef1cdcd2d1c8824ec69a565375ee44"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abfef1cdcd2d1c8824ec69a565375ee44">&#9670;&nbsp;</a></span>aimath_q31_default_init_he_uniform_cdim()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_init_he_uniform_cdim </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>tensor</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int8_t&#160;</td>
          <td class="paramname"><em>cout_axis</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with random numbers uniformly within given range, according to He et al. </p>
<p class="formulaDsp">
\[ fan_{avg} = \frac{fan_{in}}{2} \]
</p>
 <p class="formulaDsp">
\[ r = \sqrt{\frac{3}{fan_{avg}}} \]
</p>
 <p class="formulaDsp">
\[ tensor_i \in \mathcal{U(-r, r)} \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t tensor_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> tensor_params = {20, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t tensor_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> tensor = AITENSOR_2D_Q31(tensor_shape, &amp;tensor_params, tensor_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#abfef1cdcd2d1c8824ec69a565375ee44">aimath_q31_default_init_he_uniform_cdim</a>(&amp;tensor, 1);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;tensor);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_abfef1cdcd2d1c8824ec69a565375ee44"><div class="ttname"><a href="aimath__q31__default_8h.html#abfef1cdcd2d1c8824ec69a565375ee44">aimath_q31_default_init_he_uniform_cdim</a></div><div class="ttdeci">void aimath_q31_default_init_he_uniform_cdim(aitensor_t *tensor, int8_t cout_axis)</div><div class="ttdoc">Fills a Q31  tensor with random numbers uniformly within given range, according to He et al.</div></div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd>He et al., 2015 ( <a href="https://www.cv-foundation.org/openaccess/content_iccv_2015/html/He_Delving_Deep_into_ICCV_2015_paper.html">https://www.cv-foundation.org/openaccess/content_iccv_2015/html/He_Delving_Deep_into_ICCV_2015_paper.html</a> )</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*tensor</td><td>Q31 tensor to initialize with random numbers (N-D tensor) </td></tr>
    <tr><td class="paramname">cout_axis</td><td>Axis of the output channels (negative number means indexing from the end) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a68d535888ca0bc7155a80e53e3a56725"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a68d535888ca0bc7155a80e53e3a56725">&#9670;&nbsp;</a></span>aimath_q31_default_init_zeros()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_init_zeros </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>tensor</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with zeros. </p>
<p class="formulaDsp">
\[ tensor_{i} = 0 \]
</p>
<p>The function sets all tensor elements, the shift and the zero_point to 0.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t tensor_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> tensor_params;</div>
<div class="line">int32_t tensor_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> tensor = AITENSOR_2D_Q31(tensor_shape, &amp;tensor_params, tensor_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a68d535888ca0bc7155a80e53e3a56725">aimath_q31_default_init_zeros</a>(&amp;tensor);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;tensor);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a68d535888ca0bc7155a80e53e3a56725"><div class="ttname"><a href="aimath__q31__default_8h.html#a68d535888ca0bc7155a80e53e3a56725">aimath_q31_default_init_zeros</a></div><div class="ttdeci">void aimath_q31_default_init_zeros(aitensor_t *tensor)</div><div class="ttdoc">Fills a Q31  tensor with zeros.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*tensor</td><td>Q31 tensor to set to zero (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a8639f9d5f5da2d7255e157902d07777b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8639f9d5f5da2d7255e157902d07777b">&#9670;&nbsp;</a></span>aimath_q31_default_leaky_relu()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_leaky_relu </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>alpha</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the leaky rectifier (leaky ReLU) value of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \begin{cases} \alpha \cdot x_i &amp; \text{if } x_i &lt; 0 \\ x_i &amp; \text{if } x_i \geq 0 \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = x.shift, zero_point = x.zero_point} by the function because the output values are in the interval (alpha * min(x), max(x)].</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {6, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="structaiscalar__q31.html">aiscalar_q31_t</a> alpha = AISCALAR_Q31(0.01f, 10, 0);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int31_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a8639f9d5f5da2d7255e157902d07777b">aimath_q31_default_leaky_relu</a>(&amp;x, &amp;alpha, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a8639f9d5f5da2d7255e157902d07777b"><div class="ttname"><a href="aimath__q31__default_8h.html#a8639f9d5f5da2d7255e157902d07777b">aimath_q31_default_leaky_relu</a></div><div class="ttdeci">void aimath_q31_default_leaky_relu(const aitensor_t *x, const void *alpha, aitensor_t *result)</div><div class="ttdoc">Calculates the leaky rectifier (leaky ReLU) value of each element in a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the leaky ReLU from (N-D tensor) </td></tr>
    <tr><td class="paramname">*alpha</td><td>Scalar \( \alpha \) (type aiscalar_q31_t) for the leakage </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a0b8e69c6c1bba4b937f95f211d035e11"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0b8e69c6c1bba4b937f95f211d035e11">&#9670;&nbsp;</a></span>aimath_q31_default_linear32()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_linear32 </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>c</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs a matrix multiplication of <a class="el" href="aimath__q31_8h.html">Q31 </a> matrices a and b and adds a vector c to each row. </p>
<p>The addition of the horizontal vector c is performed via broadcast, i.e. element wise in each column Mathematically this broadcast is equal to multiplying c with an vertical vector (with the same number of elements as c) and adding the result to a * b.</p>
<p>** The quantization parameters of the vector c have to be {zero_point = 0, shift = a.shift + b.shift}! **</p>
<p class="formulaDsp">
\[ result = a \cdot b + \left( \begin{array}{c} 1 \\ 1 \\ \vdots \\ 1 \\ \end{array}\right) \cdot c \]
</p>
<p>Example: </p><p class="formulaDsp">
\[ a = \left( \begin{array}{rrr} 1 &amp; 2 &amp; 3 \\ 4 &amp; 5 &amp; 6 \\ 7 &amp; 8 &amp; 9 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ b = \left( \begin{array}{rr} 1 &amp; 0 \\ 0 &amp; 1 \\ 0 &amp; 0 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ c = \left( \begin{array}{rr} 2 &amp; 5 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ result = a \cdot b + \left( \begin{array}{r} 1 \\ 1 \\ 1 \\ \end{array}\right) \cdot c \]
</p>
<p class="formulaDsp">
\[ = \left( \begin{array}{rr} 1 &amp; 2 \\ 4 &amp; 5 \\ 7 &amp; 8 \end{array}\right) + \left( \begin{array}{rr} 2 &amp; 5 \\ 2 &amp; 5 \\ 2 &amp; 5 \end{array}\right) \]
</p>
<p class="formulaDsp">
\[ = \left( \begin{array}{rr} 3 &amp; 7 \\ 6 &amp; 10 \\ 9 &amp; 13 \end{array}\right) \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {3, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t a_data[3*3] = { 2,  4,  6,</div>
<div class="line">                        8, 10, 12,</div>
<div class="line">                       14, 16, 18};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q31(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {3, 2};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> b_params = {2, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t b_data[3*2] = {4, 0,</div>
<div class="line">                       0, 4,</div>
<div class="line">                       0, 0};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q31(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t c_shape[2] = {1, 2};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> c_params = {3, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t c_data[1*2] = {16, 40};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> c = AITENSOR_2D_Q31(c_shape, &amp;c_params, c_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {3, 2};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params = {4, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[3*2];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a0b8e69c6c1bba4b937f95f211d035e11">aimath_q31_default_linear32</a>(&amp;a, &amp;b, &amp;c, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a0b8e69c6c1bba4b937f95f211d035e11"><div class="ttname"><a href="aimath__q31__default_8h.html#a0b8e69c6c1bba4b937f95f211d035e11">aimath_q31_default_linear32</a></div><div class="ttdeci">void aimath_q31_default_linear32(const aitensor_t *a, const aitensor_t *b, const aitensor_t *c, aitensor_t *result)</div><div class="ttdoc">Performs a matrix multiplication of Q31  matrices a and b and adds a vector c to each row.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q31 matrix a (2D tensor of shape [N x K]) </td></tr>
    <tr><td class="paramname">*b</td><td>Q31 matrix b (2D tensor of shape [K x M]) </td></tr>
    <tr><td class="paramname">*c</td><td>Q31 vector c (2D tensor of shape [1 x M]) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 matrix (2D tensor of shape [N x M]) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a210ed501ad2308761defaf4c721d60a1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a210ed501ad2308761defaf4c721d60a1">&#9670;&nbsp;</a></span>aimath_q31_default_mat_mul()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_mat_mul </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs a matrix multiplication of <a class="el" href="aimath__q31_8h.html">Q31 </a> matrices a and b. </p>
<p class="formulaDsp">
\[ result = a \cdot b \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {3, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t a_data[3*3] = { 2,  4,  6,</div>
<div class="line">                        8, 10, 12,</div>
<div class="line">                       14, 16, 18};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q31(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {3, 2};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> b_params = {2, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t b_data[3*2] = {4, 0,</div>
<div class="line">                       0, 4,</div>
<div class="line">                       0, 0};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q31(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {3, 2};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[3*2];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a210ed501ad2308761defaf4c721d60a1">aimath_q31_default_mat_mul</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a210ed501ad2308761defaf4c721d60a1"><div class="ttname"><a href="aimath__q31__default_8h.html#a210ed501ad2308761defaf4c721d60a1">aimath_q31_default_mat_mul</a></div><div class="ttdeci">void aimath_q31_default_mat_mul(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs a matrix multiplication of Q31  matrices a and b.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q31 matrix a (2D tensor of shape [N x K]) </td></tr>
    <tr><td class="paramname">*b</td><td>Q31 matrix b (2D tensor of shape [K x M]) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 matrix of the multiplication (2D tensor of shape [N x M]) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a4a59d9f24166fe63acb51a959bfff102"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4a59d9f24166fe63acb51a959bfff102">&#9670;&nbsp;</a></span>aimath_q31_default_multiply()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_multiply </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise multiplication of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors a and b (Hadamard product) </p>
<p class="formulaDsp">
\[ result = a \circ b \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q31(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> b_params = {2, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t b_data[2*3] = {  4,  -8,   12,</div>
<div class="line">                        -16,  20, -24};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q31(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a4a59d9f24166fe63acb51a959bfff102">aimath_q31_default_multiply</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a4a59d9f24166fe63acb51a959bfff102"><div class="ttname"><a href="aimath__q31__default_8h.html#a4a59d9f24166fe63acb51a959bfff102">aimath_q31_default_multiply</a></div><div class="ttdeci">void aimath_q31_default_multiply(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs an element wise multiplication of Q31  tensors a and b (Hadamard product)</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q31 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*b</td><td>Q31 tensor b (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor of the element wise multiplication (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a1eee53561fd10925686daef72b5f5680"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1eee53561fd10925686daef72b5f5680">&#9670;&nbsp;</a></span>aimath_q31_default_norm_squared()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_norm_squared </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the squared sum of all elements in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result = \sum_i x_{i}^2 \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="structaiscalar__q31.html">aiscalar_q31_t</a> result = {0, 2, 0}; <span class="comment">// Value, shift, zero_point</span></div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a1eee53561fd10925686daef72b5f5680">aimath_q31_default_norm_squared</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#aaa9ca757028820849ef3dde13cc46565">print_aiscalar</a>(&amp;result, <a class="code" href="aimath__q31_8h.html#ac5314582da98b2cdbe4b445ea25f0b77">aiq31</a>);</div>
<div class="ttc" id="aaimath__basic_8h_html_aaa9ca757028820849ef3dde13cc46565"><div class="ttname"><a href="aimath__basic_8h.html#aaa9ca757028820849ef3dde13cc46565">print_aiscalar</a></div><div class="ttdeci">void print_aiscalar(const void *scalar, const aimath_dtype_t *dtype)</div><div class="ttdoc">Printing a scalar to console.</div></div>
<div class="ttc" id="aaimath__q31_8h_html_ac5314582da98b2cdbe4b445ea25f0b77"><div class="ttname"><a href="aimath__q31_8h.html#ac5314582da98b2cdbe4b445ea25f0b77">aiq31</a></div><div class="ttdeci">const aimath_dtype_t * aiq31</div><div class="ttdoc">The Q31 data-type indicator.</div></div>
<div class="ttc" id="aaimath__q31__default_8h_html_a1eee53561fd10925686daef72b5f5680"><div class="ttname"><a href="aimath__q31__default_8h.html#a1eee53561fd10925686daef72b5f5680">aimath_q31_default_norm_squared</a></div><div class="ttdeci">void aimath_q31_default_norm_squared(const aitensor_t *x, void *result)</div><div class="ttdoc">Calculates the squared sum of all elements in a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor x (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Scalar result (type aiscalar_q31_t) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ae308be51fead200a1bd035e22dc2b9ba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae308be51fead200a1bd035e22dc2b9ba">&#9670;&nbsp;</a></span>aimath_q31_default_relu()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_relu </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the rectifier (ReLU) value of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = max(0, x_{i}) \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = x.shift, zero_point = x.zero_point} by the function because the output values are in the interval [0, max(x)].</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params;</div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#ae308be51fead200a1bd035e22dc2b9ba">aimath_q31_default_relu</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_ae308be51fead200a1bd035e22dc2b9ba"><div class="ttname"><a href="aimath__q31__default_8h.html#ae308be51fead200a1bd035e22dc2b9ba">aimath_q31_default_relu</a></div><div class="ttdeci">void aimath_q31_default_relu(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the rectifier (ReLU) value of each element in a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the ReLU from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a07b0b5fde17397ed90e43c27673c83aa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a07b0b5fde17397ed90e43c27673c83aa">&#9670;&nbsp;</a></span>aimath_q31_default_scalar_mul()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_scalar_mul </td>
          <td>(</td>
          <td class="paramtype">const void *&#160;</td>
          <td class="paramname"><em>scalar</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs a scalar multiplication (scaling) of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor a and a scalar. </p>
<p class="formulaDsp">
\[ result = scalar \cdot a \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q31(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="structaiscalar__q31.html">aiscalar_q31_t</a> scalar = AISCALAR_Q31(0.1f, 10, 0); <span class="comment">// (value, shift, zero_point)</span></div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params = {7, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a07b0b5fde17397ed90e43c27673c83aa">aimath_q31_default_scalar_mul</a>(&amp;scalar, &amp;a, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a07b0b5fde17397ed90e43c27673c83aa"><div class="ttname"><a href="aimath__q31__default_8h.html#a07b0b5fde17397ed90e43c27673c83aa">aimath_q31_default_scalar_mul</a></div><div class="ttdeci">void aimath_q31_default_scalar_mul(const void *scalar, const aitensor_t *a, aitensor_t *result)</div><div class="ttdoc">Performs a scalar multiplication (scaling) of Q31  tensor a and a scalar.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*scalar</td><td>Scalar (type aiscalar_q31_t) </td></tr>
    <tr><td class="paramname">*a</td><td>Q31 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor of the scalar multiplication (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a173b48fe6e4d1fb5dcb441954a05afe7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a173b48fe6e4d1fb5dcb441954a05afe7">&#9670;&nbsp;</a></span>aimath_q31_default_sigmoid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_sigmoid </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the sigmoid of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \sigma(x_{i}) = \frac{1}{1 + e^{-x_{i}}} \]
</p>
<p>The sigmoid is calculated with a piecewise linear approximation (PLAN) to avoid using exponential functions.</p>
<p class="formulaDsp">
\[ result_{i} = \sigma_{PLAN}(x_i) = \begin{cases} 1 &amp; \text{if } 5 \leq x_i\\ 0.03125 \cdot |x_i| + 0.84375 &amp; \text{if } 2.375 \leq x_i &lt; 5\\ 0,0125 \cdot |x_i| + 0,625 &amp; \text{if } 1 \leq x_i &lt; 2.375\\ 0,25 \cdot |x_i| + 0.5 &amp; \text{if } 0 \leq x_i &lt; 1\\ 1 - \sigma_{PLAN}(- x_i) &amp; \text{if } x_i &lt; 0\\ \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 32, zero_point = -2^31} by the function because the output values are in the interval (0, 1).</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params;</div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a173b48fe6e4d1fb5dcb441954a05afe7">aimath_q31_default_sigmoid</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
</div><!-- fragment --><dl class="section see"><dt>See also</dt><dd>Sigmoid PLAN: <a href="https://www.researchgate.net/figure/Comparative-representation-of-the-sigmoid-function-and-PLAN-approximation_fig7_228618304">https://www.researchgate.net/figure/Comparative-representation-of-the-sigmoid-function-and-PLAN-approximation_fig7_228618304</a></dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the sigmoid from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aa79d9561f6461efaf6bd01590d38ae98"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa79d9561f6461efaf6bd01590d38ae98">&#9670;&nbsp;</a></span>aimath_q31_default_softmax()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_softmax </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the softmax value of each batch element (row) of a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \frac{e^{x_i}}{\sum_{j=1}^{K} e^{x_j}} = \frac{e^{x_i - x_{max}}}{\sum_{j=1}^{K} e^{x_j - x_{max}}} \]
</p>
<p>The exponential function within softmax is calculated with a piecewise linear approximation (PLA) in the interval [-inf, 0].</p>
<p class="formulaDsp">
\[ result_{i} = e_{PLA}(x_i - x_{max}) = \begin{cases} 0.63 \cdot (x_i - x_{max}) + 1 &amp; \text{if } -1 \leq (x_i - x_{max}) &lt; 0\\ 0.23 \cdot (x_i - x_{max}) + 0.6 &amp; \text{if } -2 \leq (x_i - x_{max}) &lt; -1\\ 0.09 \cdot (x_i - x_{max}) + 0.32 &amp; \text{if } -3 \leq (x_i - x_{max}) &lt; -2\\ 0.025 \cdot (x_i - x_{max}) + 0.125 &amp; \text{if } -5 \leq (x_i - x_{max}) &lt; -3\\ 0 &amp; \text{if } (x_i - x_{max}) &lt; -5\\ \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 32, zero_point = -2147483648} by the function because the output values are in the interval (0, 1).</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params;</div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#aa79d9561f6461efaf6bd01590d38ae98">aimath_q31_default_softmax</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_aa79d9561f6461efaf6bd01590d38ae98"><div class="ttname"><a href="aimath__q31__default_8h.html#aa79d9561f6461efaf6bd01590d38ae98">aimath_q31_default_softmax</a></div><div class="ttdeci">void aimath_q31_default_softmax(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the softmax value of each batch element (row) of a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the softmax from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="acc0a1bce305f17cc13ed7ae96e17288f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acc0a1bce305f17cc13ed7ae96e17288f">&#9670;&nbsp;</a></span>aimath_q31_default_softsign()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_softsign </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the softsign value of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \frac {x_i} {1 + |x_i|} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 31, zero_point = 0} by the function because the output values are in the interval (-1, 1).</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params;</div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#acc0a1bce305f17cc13ed7ae96e17288f">aimath_q31_default_softsign</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_acc0a1bce305f17cc13ed7ae96e17288f"><div class="ttname"><a href="aimath__q31__default_8h.html#acc0a1bce305f17cc13ed7ae96e17288f">aimath_q31_default_softsign</a></div><div class="ttdeci">void aimath_q31_default_softsign(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the softsign value of each element in a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the softsign from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ad24f7f3d3b8085e7b306dcfd25eedee5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad24f7f3d3b8085e7b306dcfd25eedee5">&#9670;&nbsp;</a></span>aimath_q31_default_sqrt()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int64_t aimath_q31_default_sqrt </td>
          <td>(</td>
          <td class="paramtype">int64_t&#160;</td>
          <td class="paramname"><em>x</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates square root of an int64 value. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>q31 Value to calculate square root of </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Square root of x </dd></dl>

</div>
</div>
<a id="a8ab2008f6346986684d2b5b7a95fc5e0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8ab2008f6346986684d2b5b7a95fc5e0">&#9670;&nbsp;</a></span>aimath_q31_default_sum_channelwise()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_sum_channelwise </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int8_t&#160;</td>
          <td class="paramname"><em>channel_axis</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sums up all values of a channel of the <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor x. </p>
<p>Calculates the sum of all elements of each channel c. The result tensor is 1D: </p><p class="formulaDsp">
\[ result_c = \sum_i(x_{ci}) \]
</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">x</td><td>Q31 input tensor (N-D) </td></tr>
    <tr><td class="paramname">channel_axis</td><td>Index of the channel axis (negative values mean indexing from the end). </td></tr>
    <tr><td class="paramname">result</td><td>Q31 result vector (1D) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aeceeacc1c2046dfa41991a39712ab030"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aeceeacc1c2046dfa41991a39712ab030">&#9670;&nbsp;</a></span>aimath_q31_default_tanh()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_tanh </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the tanh of each element in a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \tanh(x_{i}) = \frac{e^{x_i} - e^{-x_i}}{e^{x_i} + e^{-x_i}} \]
</p>
<p>The tanh is calculated with a piecewise linear approximation (PLA) to avoid using exponential functions.</p>
<p class="formulaDsp">
\[ result_{i} = \tanh_{PLA}(x_i) = 2 \cdot \sigma(2x_i) - 1 = \begin{cases} 1 &amp; \text{if } 5 \leq x_i\\ 0.0625 \cdot |x_i| + 0.6875 &amp; \text{if } 2.375 \leq x_i &lt; 5\\ 0.25 \cdot |x_i| + 0.25 &amp; \text{if } 1 \leq x_i &lt; 2.375\\ 0.5 \cdot |x_i| &amp; \text{if } 0 \leq x_i &lt; 1\\ - \tanh_{PLA}(- x_i) &amp; \text{if } x_i &lt; 0\\ \end{cases} \]
</p>
<p><b>The quantization parameters of the result tensor are set to {shift = 31, zero_point = 0} by the function because the output values are in the interval (-1, 1).</b></p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                       -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params;</div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#aeceeacc1c2046dfa41991a39712ab030">aimath_q31_default_tanh</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the tanh from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aaf4080020d251d878859d9a2ae27c53f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaf4080020d251d878859d9a2ae27c53f">&#9670;&nbsp;</a></span>aimath_q31_default_tensor_add_different_shift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_tensor_add_different_shift </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise addition of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors a and b with different shifts. </p>
<p class="formulaDsp">
\[ result = a + b \]
</p>
<p>The tensors a, b and result can have different shifts. The function will rescale the tensors internally to perform the addition. If a, b and result have the same shift, use <a class="el" href="aimath__q31__default_8h.html#a7f943a7bdaed4630bb1e2a8418898dc1" title="Performs an element wise addition of Q31  tensors a and b with same shifts.">aimath_q31_default_tensor_add_same_shift()</a> instead because it is more efficient.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q31(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> b_params = {2, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t b_data[2*3] = {  4,  -8,   12,</div>
<div class="line">                        -16,  20, -24};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q31(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params = {0, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#aaf4080020d251d878859d9a2ae27c53f">aimath_q31_default_tensor_add_different_shift</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_aaf4080020d251d878859d9a2ae27c53f"><div class="ttname"><a href="aimath__q31__default_8h.html#aaf4080020d251d878859d9a2ae27c53f">aimath_q31_default_tensor_add_different_shift</a></div><div class="ttdeci">void aimath_q31_default_tensor_add_different_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs an element wise addition of Q31  tensors a and b with different shifts.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q31 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*b</td><td>Q31 tensor b (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor of the element wise addition (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a7f943a7bdaed4630bb1e2a8418898dc1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7f943a7bdaed4630bb1e2a8418898dc1">&#9670;&nbsp;</a></span>aimath_q31_default_tensor_add_same_shift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_tensor_add_same_shift </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise addition of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors a and b with same shifts. </p>
<p class="formulaDsp">
\[ result = a + b \]
</p>
<p>The tensors a, b and result must have the same shift. If a, b and result have the different shifts, use <a class="el" href="aimath__q31__default_8h.html#aaf4080020d251d878859d9a2ae27c53f" title="Performs an element wise addition of Q31  tensors a and b with different shifts.">aimath_q31_default_tensor_add_different_shift()</a> instead.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q31(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> b_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t b_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q31(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a7f943a7bdaed4630bb1e2a8418898dc1">aimath_q31_default_tensor_add_same_shift</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a7f943a7bdaed4630bb1e2a8418898dc1"><div class="ttname"><a href="aimath__q31__default_8h.html#a7f943a7bdaed4630bb1e2a8418898dc1">aimath_q31_default_tensor_add_same_shift</a></div><div class="ttdeci">void aimath_q31_default_tensor_add_same_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs an element wise addition of Q31  tensors a and b with same shifts.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q31 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*b</td><td>Q31 tensor b (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor of the element wise addition (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aefab1f6288cfad6d4d65b095d6c2283d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aefab1f6288cfad6d4d65b095d6c2283d">&#9670;&nbsp;</a></span>aimath_q31_default_tensor_init_uniform()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_tensor_init_uniform </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>tensor</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>from</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>to</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with random numbers created from a uniform distribution within given range. </p>
<p class="formulaDsp">
\[ tensor_i \in \mathcal{U(from, to)} \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t tensor_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> tensor_params = {20, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t tensor_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> tensor = AITENSOR_2D_Q31(tensor_shape, &amp;tensor_params, tensor_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#aefab1f6288cfad6d4d65b095d6c2283d">aimath_q31_default_tensor_init_uniform</a>(&amp;tensor, -1.5f, 1.5f);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;tensor);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_aefab1f6288cfad6d4d65b095d6c2283d"><div class="ttname"><a href="aimath__q31__default_8h.html#aefab1f6288cfad6d4d65b095d6c2283d">aimath_q31_default_tensor_init_uniform</a></div><div class="ttdeci">void aimath_q31_default_tensor_init_uniform(aitensor_t *tensor, float from, float to)</div><div class="ttdoc">Fills a Q31  tensor with random numbers created from a uniform distribution within given range.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*tensor</td><td>Q31 tensor to initialize with random numbers (N-D tensor) </td></tr>
    <tr><td class="paramname">from</td><td>Minimum value of the uniform distribution </td></tr>
    <tr><td class="paramname">to</td><td>Maximum value of the uniform distribution </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="afbbdfc6c4787782533e79df8aab5c3ba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afbbdfc6c4787782533e79df8aab5c3ba">&#9670;&nbsp;</a></span>aimath_q31_default_tensor_sqrt()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_tensor_sqrt </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>x</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Calculates the element wise square root of a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor. </p>
<p class="formulaDsp">
\[ result_{i} = \sqrt{x_{i}} \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t x_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> x_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t x_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> x = AITENSOR_2D_Q31(x_shape, &amp;x_params, x_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params = {10, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#afbbdfc6c4787782533e79df8aab5c3ba">aimath_q31_default_tensor_sqrt</a>(&amp;x, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_afbbdfc6c4787782533e79df8aab5c3ba"><div class="ttname"><a href="aimath__q31__default_8h.html#afbbdfc6c4787782533e79df8aab5c3ba">aimath_q31_default_tensor_sqrt</a></div><div class="ttdeci">void aimath_q31_default_tensor_sqrt(const aitensor_t *x, aitensor_t *result)</div><div class="ttdoc">Calculates the element wise square root of a Q31  tensor.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*x</td><td>Q31 tensor to calculate the square root from (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a0519d352e63c9eee09450bb434bf76cf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0519d352e63c9eee09450bb434bf76cf">&#9670;&nbsp;</a></span>aimath_q31_default_tensor_sub_different_shift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_tensor_sub_different_shift </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise subtraction of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors a and b with different shifts. </p>
<p class="formulaDsp">
\[ result = a - b \]
</p>
<p>The tensors a, b and result can have different shifts. The function will rescale the tensors internally to perform the subtraction. If a, b and result have the same shift, use <a class="el" href="aimath__q31__default_8h.html#aa21f4253c5887e2c14138fe8ccd269a5" title="Performs an element wise subtraction of Q31  tensors a and b with same shifts.">aimath_q31_default_tensor_sub_same_shift()</a> instead because it is more efficient.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q31(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> b_params = {2, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t b_data[2*3] = {  4,    8,   12,</div>
<div class="line">                         16,  20,   24};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q31(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params = {0, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a0519d352e63c9eee09450bb434bf76cf">aimath_q31_default_tensor_sub_different_shift</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a0519d352e63c9eee09450bb434bf76cf"><div class="ttname"><a href="aimath__q31__default_8h.html#a0519d352e63c9eee09450bb434bf76cf">aimath_q31_default_tensor_sub_different_shift</a></div><div class="ttdeci">void aimath_q31_default_tensor_sub_different_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs an element wise subtraction of Q31  tensors a and b with different shifts.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q31 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*b</td><td>Q31 tensor b (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor of the element wise subtraction (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aa21f4253c5887e2c14138fe8ccd269a5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa21f4253c5887e2c14138fe8ccd269a5">&#9670;&nbsp;</a></span>aimath_q31_default_tensor_sub_same_shift()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_tensor_sub_same_shift </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>b</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>result</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Performs an element wise subtraction of <a class="el" href="aimath__q31_8h.html">Q31 </a> tensors a and b with same shifts. </p>
<p class="formulaDsp">
\[ result = a - b \]
</p>
<p>The tensors a, b and result must have the same shift. If a, b and result have the different shifts, use <a class="el" href="aimath__q31__default_8h.html#a0519d352e63c9eee09450bb434bf76cf" title="Performs an element wise subtraction of Q31  tensors a and b with different shifts.">aimath_q31_default_tensor_sub_different_shift()</a> instead.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t a_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> a_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t a_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                        -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> a = AITENSOR_2D_Q31(a_shape, &amp;a_params, a_data);</div>
<div class="line"> </div>
<div class="line">uint16_t b_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> b_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t b_data[2*3] = {  2,   4,   6,</div>
<div class="line">                         8,  10,  12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> b = AITENSOR_2D_Q31(b_shape, &amp;b_params, b_data);</div>
<div class="line"> </div>
<div class="line">uint16_t result_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> result_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t result_data[2*3];</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> result = AITENSOR_2D_Q31(result_shape, &amp;result_params, result_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#aa21f4253c5887e2c14138fe8ccd269a5">aimath_q31_default_tensor_sub_same_shift</a>(&amp;a, &amp;b, &amp;result);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;result);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_aa21f4253c5887e2c14138fe8ccd269a5"><div class="ttname"><a href="aimath__q31__default_8h.html#aa21f4253c5887e2c14138fe8ccd269a5">aimath_q31_default_tensor_sub_same_shift</a></div><div class="ttdeci">void aimath_q31_default_tensor_sub_same_shift(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)</div><div class="ttdoc">Performs an element wise subtraction of Q31  tensors a and b with same shifts.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*a</td><td>Q31 tensor a (N-D tensor) </td></tr>
    <tr><td class="paramname">*b</td><td>Q31 tensor b (N-D tensor) </td></tr>
    <tr><td class="paramname">*result</td><td>Resulting Q31 tensor of the element wise subtraction (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aabfe1ffbe35e165f62f11a6b25096415"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aabfe1ffbe35e165f62f11a6b25096415">&#9670;&nbsp;</a></span>aimath_q31_default_transpose_vector()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_transpose_vector </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>vector</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Transposes a <a class="el" href="aimath__q31_8h.html">Q31 </a> vector. </p>
<p>The given tensor must be a vector (2D tensor of shape [1 x N] or [N x 1]).</p>
<p class="formulaDsp">
\[ vector \leftarrow vector^T \]
</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t vector_shape[2] = {1, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> vector_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t vector_data[2*3] = {  2,  -4,   6};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> vector = AITENSOR_2D_Q31(vector_shape, &amp;vector_params, vector_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#aabfe1ffbe35e165f62f11a6b25096415">aimath_q31_default_transpose_vector</a>(&amp;vector);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;vector);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_aabfe1ffbe35e165f62f11a6b25096415"><div class="ttname"><a href="aimath__q31__default_8h.html#aabfe1ffbe35e165f62f11a6b25096415">aimath_q31_default_transpose_vector</a></div><div class="ttdeci">void aimath_q31_default_transpose_vector(aitensor_t *vector)</div><div class="ttdoc">Transposes a Q31  vector.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*vector</td><td>Q31 vector (2D tensor of shape [1 x N] or [N x 1]) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a363b2bdd94a1057adc55433ab68580a1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a363b2bdd94a1057adc55433ab68580a1">&#9670;&nbsp;</a></span>aimath_q31_default_zero_tensor()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void aimath_q31_default_zero_tensor </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structaitensor.html">aitensor_t</a> *&#160;</td>
          <td class="paramname"><em>tensor</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Fills a <a class="el" href="aimath__q31_8h.html">Q31 </a> tensor with zeros. </p>
<p class="formulaDsp">
\[ tensor_{i} = 0 \]
</p>
<p>The function sets all tensor elements to the zero_point given in the tensor parameters.</p>
<p>Example: </p><div class="fragment"><div class="line">uint16_t tensor_shape[2] = {2, 3};</div>
<div class="line"><a class="code" href="structaimath__q31__params.html">aimath_q31_params_t</a> tensor_params = {1, 0}; <span class="comment">// {shift, zero point}</span></div>
<div class="line">int32_t tensor_data[2*3] = {  2,  -4,   6,</div>
<div class="line">                             -8,  10, -12};</div>
<div class="line"><a class="code" href="structaitensor.html">aitensor_t</a> tensor = AITENSOR_2D_Q31(tensor_shape, &amp;tensor_params, tensor_data);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__q31__default_8h.html#a363b2bdd94a1057adc55433ab68580a1">aimath_q31_default_zero_tensor</a>(&amp;tensor);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="aimath__basic_8h.html#ab10c8d06990943806f0be8fcc6af03fc">print_aitensor</a>(&amp;tensor);</div>
<div class="ttc" id="aaimath__q31__default_8h_html_a363b2bdd94a1057adc55433ab68580a1"><div class="ttname"><a href="aimath__q31__default_8h.html#a363b2bdd94a1057adc55433ab68580a1">aimath_q31_default_zero_tensor</a></div><div class="ttdeci">void aimath_q31_default_zero_tensor(aitensor_t *tensor)</div><div class="ttdoc">Fills a Q31  tensor with zeros.</div></div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">*tensor</td><td>Q31 tensor to set to zero (N-D tensor) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_1e5d3661ed79af157d57e64a38265d09.html">basic</a></li><li class="navelem"><a class="el" href="dir_6f3c54947e40ccd50db54894d07fbfc0.html">default</a></li><li class="navelem"><a class="el" href="dir_973bc2385ef3e651973e652a47ef087c.html">aimath</a></li><li class="navelem"><a class="el" href="aimath__q31__default_8h.html">aimath_q31_default.h</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
